<?php
class Mweibo extends CI_Model{
	function __construct(){
		parent::__construct();
	}
	function saveWeibo($uid,$wid,$url){
		$this->delWeibo($wid, $uid);
		$sql = "insert into tbweibo(uid,url,wid,status) values(?,?,?,1)";
		$this->db->query($sql,array("$uid","$url","$wid"));
		return $this->db->affected_rows();
	}
	function delWeibo($wid,$uid){
		$sql = "delete from tbweibo 
				where wid = ? and uid = ?";
		$this->db->query($sql,array("$wid","$uid"));
	}
	function loadWeibo($uid){
		$sql = "select *
				from tbweibo
				where uid = ?";
		$query = $this->db->query($sql,array("$uid"));
		return $query->result();
	}
}

?>